package guoanmaker.operator.business.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.operator.business.model.OperatorCities;
import guoanmaker.operator.business.model.OperatorNaviga;
import guoanmaker.operator.business.service.OperatorNavigaService;
import guoanmaker.operator.helper.common.AjaxJson;
import guoanmaker.operator.helper.common.abstractobj.ApiController;
import io.swagger.annotations.ApiOperation;
/**
 * 
* @ClassName: OperatorNavigaController
* @Description:TODO (这里用一句话描述这个类的作用) 
* @author lihongyu
* @date 2017年7月20日 上午10:34:27 
*  
 */
@RestController
@RequestMapping(ApiController.OPERATOR_NAVIGA)
public class OperatorNavigaController {
	@Autowired
	private OperatorNavigaService operatorNavigaService;
	 @ApiOperation(value = "pc首页保存服务项", notes = "新增/修改服务项")
	    @PostMapping(value = "saveNaviga")
	    public AjaxJson saveNaviga(@RequestBody OperatorNaviga operatorNaviga) {
		 AjaxJson ajaxJson=new AjaxJson();
		 OperatorNaviga opnaviga= operatorNavigaService.saveOperatorNaviga(operatorNaviga);
		 if(operatorNaviga!=null){
			 ajaxJson.setSuccess(true).setStatus(200).setData(opnaviga);
		 }else{
			 ajaxJson.setSuccess(false).setStatus(250).setMsg("保存失败");
		 }
	        return ajaxJson;
	    }
	 
	 @ApiOperation(value = "pc首页服务项回显", notes = "pc首页服务项回显")
	    @PostMapping(value = "selectNaviga")
	    public AjaxJson selectNaviga(String cityCode) {
		 AjaxJson ajaxJson=new AjaxJson();
		 OperatorNaviga opnaviga= operatorNavigaService.selectOperatorNaviga(cityCode);
		 if(opnaviga!=null){
			 ajaxJson.setSuccess(true).setStatus(200).setData(opnaviga);
		 }else{
			 ajaxJson.setSuccess(false).setStatus(250).setMsg("查询失败");
		 }
	        return ajaxJson;
	    }

}
